﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VSDBM.Code.dto;
using VSDBM.Code.dao;

public partial class Visual_Messages_sendmessage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btyes_Click(object sender, ImageClickEventArgs e)
    {
        VSDBM.Code.dto.User usuariologado = (VSDBM.Code.dto.User)HttpContext.Current.Session["usuariologado"];
        Message newmessage = new Message(0, int.Parse(ddtouser.SelectedValue.ToString()), usuariologado.id, tbtitle.Text, tbmessage.Text, DateTime.Now.ToString(), 1);
        if (MessageDAO.sendMessage(newmessage).Equals("true"))
        {
            Response.Redirect("inbox.aspx");
        }
        else
        {
            lberro.Text = MessageDAO.sendMessage(newmessage);
        }
    }

    protected void btgo_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("inbox.aspx");
    }
}